package trade

import (
	"sync"
)

// FastBuyPosQueryResult 结构体
type FastBuyPosQueryResult struct {
	// 五道口订单id
	BizOrderId string `json:"biz_order_id,omitempty" xml:"biz_order_id,omitempty"`
	// 返回的错误码
	ReturnCode string `json:"return_code,omitempty" xml:"return_code,omitempty"`
	// 错误信息
	ReturnMsg string `json:"return_msg,omitempty" xml:"return_msg,omitempty"`
	// 商品分摊优惠
	ItemPromotions string `json:"item_promotions,omitempty" xml:"item_promotions,omitempty"`
	// 优惠券优惠金额
	CouponFee int64 `json:"coupon_fee,omitempty" xml:"coupon_fee,omitempty"`
	// 订单状态：1为已下单，未支付；2为交易完成；3为已退款；4为已关单
	OrderStatus int64 `json:"order_status,omitempty" xml:"order_status,omitempty"`
	// 优惠活动优惠金额
	PromotionFee int64 `json:"promotion_fee,omitempty" xml:"promotion_fee,omitempty"`
	// 是否调用成功
	Success bool `json:"success,omitempty" xml:"success,omitempty"`
}

var poolFastBuyPosQueryResult = sync.Pool{
	New: func() any {
		return new(FastBuyPosQueryResult)
	},
}

// GetFastBuyPosQueryResult() 从对象池中获取FastBuyPosQueryResult
func GetFastBuyPosQueryResult() *FastBuyPosQueryResult {
	return poolFastBuyPosQueryResult.Get().(*FastBuyPosQueryResult)
}

// ReleaseFastBuyPosQueryResult 释放FastBuyPosQueryResult
func ReleaseFastBuyPosQueryResult(v *FastBuyPosQueryResult) {
	v.BizOrderId = ""
	v.ReturnCode = ""
	v.ReturnMsg = ""
	v.ItemPromotions = ""
	v.CouponFee = 0
	v.OrderStatus = 0
	v.PromotionFee = 0
	v.Success = false
	poolFastBuyPosQueryResult.Put(v)
}
